import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    count: 0,
    city: {
      title: '',
      lat: '',
      lon: ''
    }
  },
  mutations: {
    increment: (state) => {
      const obj = state
      obj.count += 1
    },
    decrement: (state) => {
      const obj = state
      obj.count -= 1
    },
    cityChoice: (state, n) => {
      state.city.title = n.title
      state.city.lat = n.lat
      state.city.lon = n.lon
      console.log(state.city)
    }
  }
})

export default store
